//
//  HJNavigationViewController.m
//  Sneakers
//
//  Created by 胡光健 on 2017/9/19.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HJNavigationViewController.h"
#import "UINavigationBar+DropShadow.h"

@interface HJNavigationViewController ()

@end

@implementation HJNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = HJColorRGB(255);
    [[UITabBar appearance] setBackgroundColor:HJColorRGB(255)];
    self.navigationBar.translucent = NO;
    self.navigationBar.tintColor = HJColorRGB(0);
    self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: HJColorRGB(0), NSFontAttributeName:[UIFont boldSystemFontOfSize:18]};
    self.navigationBar.backgroundColor = [UIColor whiteColor];
//    if (@available(iOS 11.0, *)) {
//        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
//        [UITableView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
//        [UITableView appearance].estimatedRowHeight = 0.0;
//        [UITableView appearance].estimatedSectionFooterHeight = 0.0;
//        [UITableView appearance].estimatedSectionHeaderHeight = 0.0;
//    } else {
//        self.automaticallyAdjustsScrollViewInsets = YES;
//    }
    [self.navigationBar dropShadowWithOffset:CGSizeZero radius:3 color:HJColorRGB(0) opacity:0.25];
    
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
//        UIButton * btn = [self configWithButton:@"" selecteTitle:@"" titleColor:nil selecteTitleColor:nil frame:CGRectMake(0, 0, 30, 30) backGroundImage:nil image:HJImage(@"Fill 1") selecteImage:nil font:nil];
//        [btn addTarget:self action:@selector(backClicked:) forControlEvents:UIControlEventTouchUpInside];
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"Fill 1"] style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
    }
    [super pushViewController:viewController animated:YES];
}

- (void)back:(UIBarButtonItem *)item {
    [self popViewControllerAnimated:YES];
}

-(void)backClicked:(UIButton *)btn {
    [self popViewControllerAnimated:YES];
}

@end
